## ELF Header
7f 45 4c 46        ## e_ident[EI_MAG0-3] ELF's magic number
02                 ## e_ident[EI_CLASS] Indicating 64 bit
01                 ## e_ident[EI_DATA] Indicating little endianness
01                 ## e_ident[EI_VERSION] Indicating original elf
00                 ## e_ident[EI_OSABI] Set at 0 because none cares
00                 ## e_ident[EI_ABIVERSION] See above
00 00 00 00 00 00 00
02 00              ## e_type Indicating Executable
3e 00              ## e_machine Indicating AMD64
01 00 00 00        ## e_version Indicating original elf
b0 00 40 00 00 00 00 00 ## e_entry Address of the entry point
40 00 00 00 00 00 00 00 ## e_phoff Address of program header table
00 00 00 00 00 00 00 00 ## e_shoff Address of section header table
00 00 00 00        ## e_flags
40 00              ## e_ehsize Indicating our 64 Byte header
38 00              ## e_phentsize size of a program header table
02 00              ## e_phnum number of entries in program table
40 00              ## e_shentsize size of a section header table
00 00              ## e_shnum number of entries in section table
00 00              ## e_shstrndx index of the section names

## Program Header table
01 00 00 00             ## p_type
05 00 00 00             ## Flags
00 00 00 00 00 00 00 00 ## p_offset
00 00 40 00 00 00 00 00 ## p_vaddr
00 00 40 00 00 00 00 00 ## Undefined
11 01 00 00 00 00 00 00 ## p_filesz
11 01 00 00 00 00 00 00 ## p_memsz
00 00 20 00 00 00 00 00 ## Required alignment

## BSS section header
01 00 00 00             ## p_type
06 00 00 00             ## Flags
14 01 00 00 00 00 00 00 ## p_offset
14 01 60 00 00 00 00 00 ## p_vaddr
14 01 60 00 00 00 00 00 ## Undefined
00 00 00 00 00 00 00 00 ## p_filesz
00 00 40 00 00 00 00 00 ## p_memsz (4MB)
00 00 20 00 00 00 00 00 ## Required alignment

:_start
c6 04 25 e4 01 60 00  # movb   $0x54,0x6001e4
54 
c6 04 25 e5 01 60 00  # movb   $0x65,0x6001e5
65 
c6 04 25 e6 01 60 00  # movb   $0x73,0x6001e6
73 
c6 04 25 e7 01 60 00  # movb   $0x74,0x6001e7
74 
c6 04 25 e8 01 60 00  # movb   $0x53,0x6001e8
53 
c6 04 25 e9 01 60 00  # movb   $0x54,0x6001e9
54 
c6 04 25 ea 01 60 00  # movb   $0x72,0x6001ea
72 
48 c7 c0 04 02 60 00  # mov    $0x600204,%rax
e8 *getstr            # callq  400131 <getstr>
48 c7 c0 01 00 00 00  # mov    $0x1,%rax
48 c7 c7 01 00 00 00  # mov    $0x1,%rdi
48 c7 c6 04 02 60 00  # mov    $0x600204,%rsi
48 c7 c2 2a 00 00 00  # mov    $0x2a,%rdx
0f 05                 # syscall 
48 c7 c1 e4 01 60 00  # mov    $0x6001e4,%rcx
48 c7 c2 04 02 60 00  # mov    $0x600204,%rdx
e8 *strcmp            # callq  4001ae <strcmp>
48 89 c7              # mov    %rax,%rdi
48 c7 c0 3c 00 00 00  # mov    $0x3c,%rax
0f 05                 # syscall 

:getstr
48 89 c3              # mov    %rax,%rbx
:getstr.loop
e8 *getchar           # callq  40014b <getchar>
48 83 f8 ff           # cmp    $0xffffffffffffffff,%rax
74 .getstr.done       # je     400147 <getstr.done>
88 03                 # mov    %al,(%rbx)
48 83 c3 01           # add    $0x1,%rbx
eb .getstr.loop       # jmp    400134 <getstr.loop>
:getstr.done
c6 03 00              # movb   $0x0,(%rbx)
c3                    # retq   

:getchar
48 c7 c0 00 00 00 00  # mov    $0x0,%rax
48 c7 c7 00 00 00 00  # mov    $0x0,%rdi
48 8d 34 25 2e 02 60  # lea    0x60022e,%rsi
00 
48 c7 c2 01 00 00 00  # mov    $0x1,%rdx
0f 05                 # syscall 
48 83 f8 01           # cmp    $0x1,%rax
75 .getchar.getchar_fail # jne    40017f <getchar.getchar_fail>
48 c7 c0 00 00 00 00  # mov    $0x0,%rax
8a 04 25 2e 02 60 00  # mov    0x60022e,%al
c3                    # retq   
:getchar.getchar_fail
48 c7 c0 ff ff ff ff  # mov    $0xffffffffffffffff,%rax
c3                    # retq   

:putchar
88 04 25 2e 02 60 00  # mov    %al,0x60022e
48 c7 c0 01 00 00 00  # mov    $0x1,%rax
48 c7 c7 01 00 00 00  # mov    $0x1,%rdi
48 8d 34 25 2e 02 60  # lea    0x60022e,%rsi
00 
48 c7 c2 01 00 00 00  # mov    $0x1,%rdx
0f 05                 # syscall 
c3                    # retq   

:strcmp
8a 01                 # mov    (%rcx),%al
8a 1a                 # mov    (%rdx),%bl
3c 00                 # cmp    $0x0,%al
74 .strcmp.al.eq                 # je     4001c7 <strcmp.al.eq>
80 fb 00              # cmp    $0x0,%bl
74 .strcmp.bl.eq.2                 # je     4001dc <strcmp.bl.eq.2>
38 d8                 # cmp    %bl,%al
75 .strcmp.bl.eq.2                 # jne    4001dc <strcmp.bl.eq.2>
48 ff c1              # inc    %rcx
48 ff c2              # inc    %rdx
eb .strcmp                 # jmp    4001ae <strcmp>
:strcmp.al.eq
80 fb 00              # cmp    $0x0,%bl
74 .strcmp.bl.eq.1                 # je     4001d4 <strcmp.bl.eq.1>
48 c7 c0 01 00 00 00  # mov    $0x1,%rax
c3                    # retq   
:strcmp.bl.eq.1
48 c7 c0 00 00 00 00  # mov    $0x0,%rax
c3                    # retq   
:strcmp.bl.eq.2
48 c7 c0 01 00 00 00  # mov    $0x1,%rax
c3                    # retq   
